import request from "../../utils/request";

export async function listRestrain(params) {
    const res = await request.get('/restrain/list', {
        params
    });
    if (res.data.code === 0) {
        return res.data.data || [];
    }
    return Promise.reject(new Error(res.data.message));
}

export async function saveRestrain(data) {
    const res = await request.post('/restrain/save', data);
    if (res.data.code === 0) {
        return res.data.data || '保存成功';
    }
    return Promise.reject(new Error(res.data.message));
}
